<template>
  <div>
    <Header></Header> <!-- 子页面公共头部 -->
    <div class="ej_box">
      <div class="ej_center">
        <Crumbs :lmtitle="lmtitle"></Crumbs> <!-- 面包屑导航 -->
        <div class="clear"></div>
        <div class="row">

         <!-- <div class="col-md-3">
            <SeniorSearch @search="search"></SeniorSearch>
          </div>-->
          <div class="col-md-12">
            <div class="ej_content_box">
              <div class="ej_content">
                <div class="ej_content_nav">
                  <div class="ej_content_nav_pc">
                    <h2 class="ej_content_nav_pc_h2dt">
                      <!-- class="activexz" -->
                      <li v-for="item in dhData" @click="link(item.id)"
                        :class="formdata.columnId == item.id ? 'activexz' : ''">{{ item.name }}</li>
                    </h2>

                    <div class="clearfix"></div>
                  </div>
                </div>

                <div class="ej_content_editor">
                  <div class="zcfg_con2">
                    <div class="video" style="width: 100%;">
                      <video controls preload="auto" style="width: 100%;" :src="fileUrl">
                        <!-- <source :src="fileUrl" type="video/mp4">   -->
                        <source type="video/mp4">
                      </video>
                    </div>
                  </div>
                  <div class="ej_content_editor">
                    <div class="ej_content_title">
                      <h2 class="ej_content_title_h2">{{ formdata.title }}</h2>
                    </div>
                    <div class="txl_top">
                      <div class="txl_topcon">
                        <div class="txl_top_fl">发布者：{{ formdata.author }}</div>
                        <div class="txl_top_fr">发布时间：
                          {{ formdata.createTime | formatDate }} 阅读：<span>{{ formdata.thumbs }}</span>次</div>
                      </div>
                    </div>

                    <div class="txl_nr">
                      <div class="ej_content_editor2" id="wrapper">
                        <div v-html="formdata.content"></div>

                      </div>
                    </div>
                  </div>


                </div>
              </div>
            </div>
          </div>

          <div class="clearfix"></div>
        </div>


      </div>
    </div>
    <Foot></Foot> <!-- 网站公共底部 -->
  </div>
</template>
<script>
import Foot from "@/components/foot.vue";
import Crumbs from "@/components/crumbs.vue";
import SeniorSearch from "@/components/seniorsearch.vue";
import Cookies from 'js-cookie'
import { contentApiqueryOne } from "@/api/webviews";
import Header from "@/components/header.vue";
export default {
  name: "articlecontent",
  components: {
    Header,
    Crumbs,
    SeniorSearch,
    Foot
  },
  filters: {
    formatDate(data) {
      return data.split(' ')[0]
    },
  },
  data() {
    return {
      dhData: [],
      ParentId: '',
      formdata: {},
      fontsize: '15',
      lmtitle: '精彩视频',
      ishow: true,
      fileUrl: ''
    };
  },
  created() {
    this.dhData = JSON.parse(Cookies.get('navdata'))[this.$route.query.navId]
    this.getdata(this.$route.query.id)
    if (this.$route.query.id == 'C0A8B1507E0441F28FA9448DF52AC6DC' || this.$route.query.id == '2293BE31C5B4449FA5487BA2228BA6ED') {
      this.ishow = false
    }
  },
  methods: {
    down(item) {
      window.open(item,"_blank")
    },
    search(val) {
      /*this.$router.push({
        name: 'searchresult',
        query: { formdata: JSON.stringify(val) }
      })*/
      let routeData = this.$router.resolve({
        name: 'searchresult',
        query: { formdata: JSON.stringify(val) }
      })
      window.open(routeData.href, '_blank')
    },
    setttingfont(fontsize) {
      this.fontsize = fontsize
    },
    getdata(id) {
      contentApiqueryOne({ id: id })
        .then((res) => {
          if (res.code == 0) {
            this.formdata = res.data;
            this.fileUrl = '/show' + res.data.fileUrl
          }
        })
        .catch((err) => {
          console.log(err);
        });
    },
    link(id) {
      /*this.$router.push({
        name: 'articlelistpage',
        query: { navId: this.$route.query.navId, id: id }
      })*/
      let routeData = this.$router.resolve({
        name: 'articlelistpage',
        query: { navId: this.$route.query.navId, id: id }
      })
      window.open(routeData.href, '_blank')

    },
  },
};
</script>
<style scoped>
@import "../assets/css/font/iconfont.css";
@import "../assets/css/index.css";
@import "../assets/css/style.css";
</style>
